<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="layout" content="main" />
<title>Select Activity</title>
</head>
<body>
<div class="body">
	<h1>選擇活動</h1>
		<g:if test="${flash.message}">
	        <div class="message">${flash.message}</div>
	    </g:if>
        <div class="list">
            <table>
                <thead>
                    <tr>
               	        <g:sortableColumn property="name" title="活動名稱" />
               	        <g:sortableColumn property="startAt" title="開始" />
               	        <g:sortableColumn property="endAt" title="結束" />
                    </tr>
                </thead>
                <tbody>
                <g:each in="${activityList}" status="i" var="activityInstance">
                    <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        <td><g:link action="create" params="['activity.id':activityInstance?.id]" >${fieldValue(bean:activityInstance, field:'name')}</g:link></td>
                        <td>${fieldValue(bean:activityInstance, field:'startAt')}</td>
                        <td>${fieldValue(bean:activityInstance, field:'endAt')}</td>
                    </tr>
                </g:each>
                </tbody>
            </table>
        </div>
        <div class="paginateButtons">
            <g:paginate total="${activityTotal}" />
        </div>
</div>
</body>
</html>